package fcrpt
class TrendPassYieldByMonthController {
    def dynamicQueryService
    def trendPassYieldByMonth(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def tableHeadList=[]
        def trendPassYieldByMonth=[]
        def pageSizeList = [10,20,50,100]
        def totalCount =0
        if(params.EXPORT_CONTENT_NAME=='Excel'){
            params.SYS_QUERY_NAME = 'trendPassYieldByMonth'
            trendPassYieldByMonth = dynamicQueryService.queryForList(params)
            if (trendPassYieldByMonth.size() > 0) {
                tableHeadList = trendPassYieldByMonth[0].keySet()
            }
        }
        def list1=[]
        def list2=[]
        for(int i=0;i<trendPassYieldByMonth.size();i++) {
            def ration1 = trendPassYieldByMonth[i].ACTUAL_YIELD
            list1.add(i, ration1)
            def ration2 = trendPassYieldByMonth[i].TARGET_YIELD
            list2.add(i, ration2)
        }
        print(params.startTime)
        print(params.endTime)

        [startno:params.startno?:'',
         endno:params.endno?:'',
         pageSize:pageSize,
         totalCount: totalCount,
         pageSizeList: pageSizeList,
         tableHeadList:tableHeadList,
         trendPassYieldByMonth:trendPassYieldByMonth,
         startTime:params.startTime?:'',
         endTime:params.endTime?:'',
         list1:list1,
         list2:list2
        ]
    }
}